#include <iostream>
#include <iterator>
#include <vector>
#include <algorithm>

using std::cout;
using std::endl;
using std::istream_iterator;
using std::ostream_iterator;
using std::vector;
using std::copy;

void test()
{
    vector<int> vec;

    /* cout << "1111" << endl; */
    istream_iterator<int> isi(std::cin);
    cout << "2222" << endl;

    //对于vector，要插入元素的话，需要使用push_back
    /* copy(isi, istream_iterator<int>(), vec.begin()); */
    copy(isi, istream_iterator<int>(), std::back_inserter(vec));
    /* cout << "3333" << endl; */

    //遍历vector中的元素
    copy(vec.begin(), vec.end(), 
         ostream_iterator<int>(cout, "  "));
    /* cout << "4444" << endl; */
    cout << endl;
}

int main(int argc, char *argv[])
{
    test();
    
    return 0;
}

